import { defineComponent,inject } from "vue";

export default defineComponent({
  emits: ['addData'],
//   props: {

//   },
  setup(props, ctx) {
    const configList = inject("configList");
    const addData = (item) => {
      ctx.emit("addData", item);
    };

    return () => {
      return (
        <>
          {configList.map((item) =>
            ({
              title: () => (
                <div className="editors-left-title">{item.label}</div>
              ),
              subtitle: () => (
                <div className="editors-left-subtitle">{item.label}</div>
              ),
              /* 禁用了拖拽事件 */
              undefined: () => (
                <el-button
                  onClick={() => addData(item)}
                  // draggable
                  // onDragstart={(e) => onDragstart(e, item)}
                  className="editors-left-item"
                >
                  {item.label}
                </el-button>
              ),
            }[item.word]())
          )}
        </>
      );
    };
  },
});
